package com.slf.spring.security.component.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.slf.spring.security.component.entity.SysUser;
import com.slf.spring.security.component.mapper.SysUserMapper;
import com.slf.spring.security.component.service.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author slf
 * @since 2021-07-11
 */
@Service
public class SysUserServiceImpl  implements SysUserService {
    @Autowired
    SysUserMapper userMapper;

    @Override
    public UserDetails loadUserByUsername(String s)   {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("username",s);
        SysUser user = userMapper.selectOne(wrapper);
        return user;
    }
}
